import yagmail
#链接邮箱服务器
# user@126.com 发件⼈邮箱
# 1234 发件⼈邮箱授权码(授权码，注意不是邮箱密码)
# smtp.126.com ⽹易126邮箱发件服务器
yag = yagmail.SMTP( user="user@126.com", password="1234", host='smtp.126.com')
# 邮箱正⽂
contents = ['This is the body, and here is just text http://somedomain/image.png',
'You can find an audio file attached.', '/local/path/song.mp3']
# 发送邮件
# taaa@126.com 收件⼈邮箱
# subject 邮件主题
yag.send('taaa@126.com', 'subject', contents)
